package com.meiyou.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.meiyou.mapper.TixianMapper;
import com.meiyou.mapper.TixianMapperCustom;
import com.meiyou.mapper.UserMapper;
import com.meiyou.mapper.UserMapperCustom;
import com.meiyou.pojo.Tixian;
import com.meiyou.pojo.User;
import com.meiyou.service.TixianService;

@Service("TixianService")
public class TixianServiceImpl implements TixianService{

	@Autowired
	TixianMapper tixianMapper;
	@Autowired
	UserMapperCustom userMapperCustom;
	@Autowired
	TixianMapperCustom tixianMapperCustom;
	@Autowired
	UserMapper userMapper;
	
	
	public int insertTixian(Tixian tixian) {
		// TODO Auto-generated method stub
		return tixianMapper.insert(tixian);
	}

	
	public int updateTixian(Tixian tixian) {
		// TODO Auto-generated method stub
		
		return tixianMapperCustom.updateTixiantShenhe(tixian); 
	}

	
	public List<Tixian> selectTixian(Tixian tixian) {
		// TODO Auto-generated method stub
		return tixianMapperCustom.selectAll(tixian);
	}

	
	public int updateuserMeijin(User user) {
		// TODO Auto-generated method stub
		return userMapperCustom.updateMeijin(user); 
	}

	
	public int delete(int id) {
		// TODO Auto-generated method stub
		return tixianMapper.deleteByPrimaryKey(id+"");
	}

	
	public Tixian selectById(String id) {
		// TODO Auto-generated method stub
		return tixianMapper.selectByPrimaryKey(id);
	}

	
	public double selectMeijinById(String phone) {
		// TODO Auto-generated method stub
		double meijin = userMapperCustom.selectMeijinByPhone(phone);
		return meijin;
	}
}
